package com.example.mybatisplusdemo.web.controller;

import com.example.mybatisplusdemo.model.dto.LocationRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/location")
public class LocationController {

    @PostMapping("/save")
    public ResponseEntity<?> saveUserLocation(@RequestBody LocationRequest request) {
        System.out.println("接收到用户位置: " + request);

        // 可选：保存到数据库或处理附近商家逻辑
        // 示例：返回成功
        return ResponseEntity.ok().body(Map.of("code", 200, "message", "位置已保存"));
    }
}
